﻿using System;
using System.Collections.Generic;

using System.Text;

namespace Rance.Battle
{
    class 鼓舞1 : 主动技能
    {
        public int Level = 2;
        public 鼓舞1()
        {
            this.技能速度 = 100;
            this.消耗行动点 = Battle.消耗行动点.一点;
            this.技能目标 = Battle.技能目标.己方任一;
            this.技能站位要求 = Battle.技能站位要求.无;
        }

        public override void Excute(技能环境 环境)
        {
            base.Excute(环境);            

            List<int> list = new List<int>();
            int maxItem = 4;
            int value = 环境.施放者.智 / 2;
            maxItem = maxItem > value ? value : maxItem;
            Random r = new Random(DateTime.Now.Millisecond);
            for (int i = 0; i < maxItem; i++)
            {
                int index = 环境.队伍状况.战场.乱数表.Random(0, 4);
                while (list.Contains(index))
                    index = 环境.队伍状况.战场.乱数表.Random(0, 4);

                list.Add(index);
            }
            list.Sort((m1,m2) => m1.CompareTo(m2));

            赋予Behavior behavior = new 赋予Behavior();
            List<string> 赋予list = new List<string>();
            behavior.List.Add(new 赋予BehaviorDetail() { 角色 = new 角色Struct() { ID = 环境.目标List[0].ID, Name = 环境.目标List[0].Name }, List = 赋予list });
            环境.行动结果.ResultList.Add(behavior);

            foreach (var item in list)
            {
                赋予 赋予 = null;
                

                switch (item)
                {
                    case 0:
                        赋予 = new 赋予()
                        {
                            Level = Level,
                            是否单回合 = false
                        };
                        if (环境.目标List[0].Set攻击赋予(赋予))
                        {
                            赋予list.Add("攻击");
                        }
                        break;
                    case 1:
                        赋予 = new 赋予()
                        {
                            Level = Level,
                            是否单回合 = false
                        };
                        if (环境.目标List[0].Set防御赋予(赋予))
                        {
                            赋予list.Add("防御");
                        }
                        break;
                    case 2:
                        赋予 = new 赋予()
                        {
                            Level = Level,
                            是否单回合 = false
                        };
                        if (环境.目标List[0].Set速度赋予(赋予))
                        {
                            赋予list.Add("速度");
                        }
                        break;
                    case 3:
                        赋予 = new 赋予()
                        {
                            Level = Level,
                            是否单回合 = false
                        };
                        if (环境.目标List[0].Set智力赋予(赋予))
                        {
                            赋予list.Add("智力");
                        }
                        break;
                }
            }

        }
    }

    class 鼓舞2 : 鼓舞1
    {
        public 鼓舞2()
        {
            this.Level = 3;
        }
    }
}
